package thread.thread_04_20.concurrent_sort;

import java.util.Arrays;

/**
 * @author Stark
 * @description 单线程排序
 * @date 2022/4/21 16:33
 **/
public class SingleSort {
    public static void main(String[] args) {
        long[] array = ArrayHelper.generateArray(4_000_0000);

        long start = System.currentTimeMillis();

        Arrays.sort(array,0,1_000_0000);
        Arrays.sort(array,1_000_0001,2_000_0000);
        Arrays.sort(array,2_000_0001,3_000_0000);
        Arrays.sort(array,3_000_0001,4_000_0000);
        // TODO：进行 4 路归并，将 4 个有序数组，归并成一个有序数组
        long end = System.currentTimeMillis();

        System.out.println("非并发排序用时：" + (end - start) + "ms");
    }
}
